{
  "properties" : { },
  "id" : "f4160caee4194ab7b7882cdd256a6de0",
  "script" : null,
  "groupId" : "08c2af4fd56543e690b14515d83d66ae",
  "name" : "mongo增删改查",
  "createTime" : null,
  "updateTime" : 1650019500526,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "admin",
  "path" : "cccasca",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\r\n    \"_id\": \"270002723461148672\",\r\n    \"data\": {\r\n        \"creatTime\": \"2022-04-15T18:18:54.555+0800\",\r\n        \"data\": {\r\n            \"isolateStartTime\": null,\r\n            \"city\": \"成都\",\r\n            \"checkOutType\": \"解除隔离\",\r\n            \"workableInfo\": \"居家监测\",\r\n            \"removeNoticeFlag\": \"1\",\r\n            \"estimateIsolateEndTime\": \"2022-04-22 16:14:21\",\r\n            \"cardNo\": \"95\",\r\n            \"subDays\": \"213\",\r\n            \"relationPhone\": \"无\",\r\n            \"relieveAddress\": \"舒客加酒店\",\r\n            \"leaveWay\": \"转运\",\r\n            \"relationPerson\": \"无\",\r\n            \"streetName\": \"正兴街道\",\r\n            \"roomNum\": null,\r\n            \"province\": \"四川\",\r\n            \"createTime\": \"2022-04-15 16:14:27\",\r\n            \"record\":0,\r\n            \"releaseRemark\": \"解除集中隔离备注\",\r\n            \"communityName\": \"正兴街道凉风顶社区\",\r\n            \"_id\": \"269971403267780608\",\r\n            \"region\": \"天府新区兴隆\"\r\n        },\r\n        \"dataType\": \"区平台-退房\",\r\n        \"syncStatus\": \"未同步1\"\r\n    }\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 200,\n    \"message\": \"success\",\n    \"data\": 0,\n    \"timestamp\": 1650019273611,\n    \"executeTime\": 37\n}",
  "description" : null,
  "requestBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "_id",
      "value" : "270002723461148672",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ {
        "name" : "creatTime",
        "value" : "2022-04-15T18:18:54.555+0800",
        "description" : "",
        "required" : false,
        "dataType" : "String",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "data",
        "value" : "",
        "description" : "",
        "required" : false,
        "dataType" : "Object",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ {
          "name" : "isolateStartTime",
          "value" : "null",
          "description" : "",
          "required" : false,
          "dataType" : "Object",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "city",
          "value" : "成都",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "checkOutType",
          "value" : "解除隔离",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "workableInfo",
          "value" : "居家监测",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "removeNoticeFlag",
          "value" : "1",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "estimateIsolateEndTime",
          "value" : "2022-04-22 16:14:21",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "cardNo",
          "value" : "95",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "subDays",
          "value" : "213",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "relationPhone",
          "value" : "无",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "relieveAddress",
          "value" : "舒客加酒店",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "leaveWay",
          "value" : "转运",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "relationPerson",
          "value" : "无",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "streetName",
          "value" : "正兴街道",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "roomNum",
          "value" : "null",
          "description" : "",
          "required" : false,
          "dataType" : "Object",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "province",
          "value" : "四川",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "createTime",
          "value" : "2022-04-15 16:14:27",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "record",
          "value" : "0",
          "description" : "",
          "required" : false,
          "dataType" : "Integer",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "releaseRemark",
          "value" : "解除集中隔离备注",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "communityName",
          "value" : "正兴街道凉风顶社区",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "_id",
          "value" : "269971403267780608",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        }, {
          "name" : "region",
          "value" : "天府新区兴隆",
          "description" : "",
          "required" : false,
          "dataType" : "String",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ ]
        } ]
      }, {
        "name" : "dataType",
        "value" : "区平台-退房",
        "description" : "",
        "required" : false,
        "dataType" : "String",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "syncStatus",
        "value" : "未同步1",
        "description" : "",
        "required" : false,
        "dataType" : "String",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      } ]
    } ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "200",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "0",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1650019273611",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "37",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import log;//日志模块
import mongo;   //导入mongodb模块
import org.apache.commons.collections.CollectionUtils;


var addDatas = [];

var addData ={};
addData.name = "张三";
addData.age = 20;
addData.isdel = 0;
addData.store = [{
    name:"麻辣兔头",
    isdel:0,
    age:5
},{
    name:"串串香",
    isdel:0,
    age:3
}];
addDatas.add(addData);

var addData2 ={};
addData2.name = "李四";
addData2.age = 23;
addData2.isdel = 0;
addData2.store = [{
    name:"麻将馆",
     isdel:0,
    age:6
},{
    name:"按摩院",
     isdel:1,
    age:2
}];
addDatas.add(addData2);
//新增数据
// mongo.cloudwalk_yqfk_dev.timo_test.insert(addDatas);
//修改数据
// mongo.cloudwalk_yqfk_dev.timo_test.update({"name":"张三"}, {$set:{"name":"张三2", "age":20}});
// mongo.cloudwalk_yqfk_dev.timo_test.update({"name":"张三3"}, {$set:{"name":"张三3", "sex":"男"}});

//删除
// mongo.cloudwalk_yqfk_dev.timo_test.remove({title : 'MongoDB 教程'});
// mongo.cloudwalk_yqfk_dev.timo_test.removeOne({title : 'MongoDB2 教程'});
// mongo.cloudwalk_yqfk_dev.timo_test.remove({});
//查询
// var res = mongo.cloudwalk_yqfk_dev.timo_test.find().list();
var res = mongo.cloudwalk_yqfk_dev.timo_test.find({isdel : 0}).list();
// .find({key : value}).skip(2).limit(1).list();
if (CollectionUtils.isNotEmpty(res)) {
    res.forEach(o -> {
        o["_id"] = o["_id"].toString()
    });
}

return res;

// import log;//日志模块
// import mongo;   //导入mongodb模块
// import org.apache.commons.collections.CollectionUtils;
// import log;//日志模块
// import mongo;   //导入mongodb模块
// import org.apache.commons.collections.CollectionUtils;
// import org.springframework.data.mongodb.core.query.Query
// import org.springframework.data.mongodb.core.query.Update;
// import org.springframework.data.mongodb.core.query.Criteria;
// import mongoTemplete;


// // var datas = body;
// var id = body._id;
// // return mongo.cloudwalk_yqfk_dev.yqfk_person_sync_daguan_record.update({"_id",id},{$set:body});
// //组装查询条件
// var query = new Query(Criteria.where("_id").is(id));
// //逻辑删除条件
// var update = new Update();
// for (k,v in body) {
//     update.set(k,v);
// }
// return mongoTemplete.update(query,update,"yqfk_person_sync_daguan_record");